/**
 * Created by jiaxing on 2017/11/16.
 */
$(function () {

    //初始化用户名
    $("#user").html(sessionStorage.getItem("username"));
    var date = new Date();
    var time = date.getFullYear()+"-"+Number(date.getMonth())+1+"-"+date.getDate();
    $("#time").html(time);


    //初始化学生信息的请求


        var obj = {
            url:"/shixun/stu2?id="+sessionStorage.getItem("username"),
            dataType:"json",
            type:"get",
            success:function(data){
                var Data = data[0];
                console.log(Data);

                $("#Student11_StudentNo").val(Data.id);
                $("#Student11_StudentName").val(Data.name);
                $("#Student11_NamePY").val(Data.namel);
                $("#Student11_Sex_0").val(Data.sex);
                $("#Student11_BirthDay").val(Data.birthday);
                // $("#Student11_National option[Data.volk]").selected = "selected";
                $("#Student11_GuideTeacher").val(Data.tutor);
                // $("#Student11_ZJXYDdl option[Data.rel_bel]").selected = "selected";
                // $("#Student11_Polity").val(Data.id);
                $("#Student11_InTime").val(Data.cra);
                $("#Student11_OutTime").val(Data.grade);

                $("#Student11_NativePlace").val(Data.pla);
                $("#Student21_IdCard").val(Data.idcard);
                // $("#Student21_FamillyReg input").attr("checked",false);
                // $("#Student21_FamillyReg input[value="+ Data.nodetype +""]").attr("checked",true);
                // $("#Student21_ExamineeType").val(Data.id);
                // $("#Student21_GetType1").val(Data.id);
                $("#Student21_ExamineeNo").val(Data.ad);
                $("#Student21_UnitSchool").val(Data.pre);
                $("#Student21_DoctorNo").val(Data.medcard);
                // $("#Student21_BankName").val(Data.id);
                $("#Student21_BankNo").val(Data.bankid);
                // $("#Student21_MainForLang").val(Data.id);
                // $("#Student21_IsOtherSpecialty_0").val(Data.id);
                // $("#Student21_IsSecondDegree_0").val(Data.id);
                $("#Student21_hobby").val(Data.hobby);
                $("#Student21_Strengths").val(Data.spe);
                $("#Student21_FamillyCount").val(Data.family;);
            },
            error:function(e){
                console.log(e);
            }
        }
        $.ajax(obj);


    //侧边栏点击事件
    var lis = $(".menu").children();
    console.log(lis);
    lis.click(function () {
        //console.log($(this).attr("data_name"));
        var current = $(this).attr("data_name");
        $(".content ul li").css("display","none");
        $("."+current).css("display","block");

        //ajax请求

        //学生信息
        if(current == "content_info"){
            var obj = {
                url:"/shixun/stu2?id="+sessionStorage.getItem("username"),
                dataType:"json",
                type:"get",
                success:function(data){
                    var Data = data[0];
                    console.log(Data);
                },
                error:function(e){
                    console.log(e);
                }
            }
            $.ajax(obj);
        }
        //课表
        else if(current == "content_schedule")
        {
            var obj = {
                url:"/shixun/stu2?id="+sessionStorage.getItem("username"),
                dataType:"json",
                type:"get",
                success:function(data){

                },
                error:function(e){
                    console.log(e);
                }
            }
            $.ajax(obj);
        }
        //成绩单
        else if(current == "content_report"){
            var obj = {
                url:"/shixun/stu3?id="+sessionStorage.getItem("username"),
                dataType:"json",
                type:"get",
                success:function(data){

                },
                error:function(e){
                    console.log(e);
                }
            }
            $.ajax(obj);
        }

    })
    $(".input_txt").focus(function () {
        $(this).attr("value","");
    })


})